<?php

/**
 * This is the model class for table "pendudukbayihamil".
 *
 * The followings are the available columns in table 'pendudukbayihamil':
 * @property integer $pbh_id
 * @property integer $pbh_kec
 * @property integer $pbh_penduduk
 * @property integer $pbh_bayi
 * @property integer $pbh_ibuhamil
 * @property integer $pbh_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $pbhKec
 */
class Pendudukbayihamil extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Pendudukbayihamil the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pendudukbayihamil';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('pbh_kec, pbh_penduduk, pbh_bayi, pbh_ibuhamil, pbh_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('pbh_id, pbh_kec, pbh_penduduk, pbh_bayi, pbh_ibuhamil, pbh_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'pbhKec' => array(self::BELONGS_TO, 'Kecamatan', 'pbh_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'pbh_id' => 'Pbh',
			'pbh_kec' => 'Pbh Kec',
			'pbh_penduduk' => 'Pbh Penduduk',
			'pbh_bayi' => 'Pbh Bayi',
			'pbh_ibuhamil' => 'Pbh Ibuhamil',
			'pbh_tahun' => 'Pbh Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('pbh_id',$this->pbh_id);
		$criteria->compare('pbh_kec',$this->pbh_kec);
		$criteria->compare('pbh_penduduk',$this->pbh_penduduk);
		$criteria->compare('pbh_bayi',$this->pbh_bayi);
		$criteria->compare('pbh_ibuhamil',$this->pbh_ibuhamil);
		$criteria->compare('pbh_tahun',$this->pbh_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}